from Picture import *
import unittest

class TestPicture(unittest.TestCase):
  def setUp(self):
    body = ["#.. ", "##= ", "###@", " ###"]
    self.picture = Picture(body)

  def testInit(self):
    self.assertEqual(self.picture.width, 4)
    self.assertEqual(self.picture.height, 4)

  def testEspejoV(self):
    body = [" ..#", " =##", "@###", "### "]
    self.assertEqual(Picture(body), espejoV(self.picture))

  def testEspejoH(self):
    body = [" ###", "###@", "##= ", "#.. "]
    self.assertEqual(Picture(body), espejoH(self.picture))

  def testNegativo(self):
    body = ["#@@ ", "##_ ", "###.", " ###"]
    self.assertEqual(Picture(body), negativo(self.picture))

  def testAlLado(self):
    body = ["#.. #.. ", "##= ##= ", "###@###@", " ### ###"]
    self.assertEqual(Picture(body), alLado(self.picture, self.picture))

  def testEncima(self):
    body = ["#.. ", "##= ", "###@", " ###", "#@@ ", "##_ ", "###.", " ###"]
    pn = negativo(self.picture)
    self.assertEqual(Picture(body), encima(self.picture, pn))

  def testsuperponer(self):
    body = ["#..#", "##=#", "###@", "####"]
    self.assertEqual(Picture(body), superponer(self.picture,
                                               espejoV(self.picture)))

  def testRepetirH(self):
    body = ["#.. #.. #.. ", "##= ##= ##= ", "###@###@###@", " ### ### ###"]
    self.assertEqual(Picture(body), repetirH(self.picture, 3))

  def testRepetirV(self):
    body = ["#.. ", "##= ", "###@", " ###", "#.. ", "##= ", "###@", " ###",
            "#.. ", "##= ", "###@", " ###"]
    self.assertEqual(Picture(body), repetirV(self.picture, 3))

if __name__ == '__main__':
  unittest.main()   
